#!/usr/bin/expect -f

set password "{{ mysql_admin_password }}"

set username "{{ mysql_admin_user }}"

{% if sock_type == 1 %}
spawn {{mysql_base_dir}}/bin/mysql_config_editor set --login-path={{ fcs_create_mysql_fast_login_name }} --host=localhost --socket={{ mysql_data_dir_base }}/data/{{ mysql_port }}/mysql.sock --user=$username --password
{% elif sock_type == 2 %}
spawn {{mysql_base_dir}}/bin/mysql_config_editor set --login-path={{ fcs_create_mysql_fast_login_name }} --host=localhost --socket=/tmp/mysql{{ mysql_port }}.sock --user=$username --password
{% elif sock_type == 3 %}
spawn {{mysql_base_dir}}/bin/mysql_config_editor set --login-path={{ fcs_create_mysql_fast_login_name }} --host=localhost --socket={{ mysql_data_dir_base }}/run/mysql{{ mysql_port }}.sock --user=$username --password
{% endif %}

expect "Enter password: "
send "$password\r"
expect eof
